package com.qiangesoft.rdp.starter.captcha.config;

import com.qiangesoft.rdp.starter.captcha.constant.CaptchaTypeEnum;
import com.qiangesoft.rdp.starter.captcha.constant.CharTypeEnum;
import com.qiangesoft.rdp.starter.captcha.constant.InnerFontEnum;
import com.qiangesoft.rdp.starter.captcha.core.CaptchaLocalStoreImpl;
import com.qiangesoft.rdp.starter.captcha.core.CaptchaStore;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * 验证码配置
 *
 * @author qiangesoft
 * @date 2023-09-19
 */
@Data
@Component
@ConfigurationProperties(prefix = "rdp.captcha")
public class CaptchaProperties {

    /**
     * 验证码类型
     */
    private CaptchaTypeEnum captchaType = CaptchaTypeEnum.ARITHMETIC;

    /**
     * 验证码文本类型
     */
    private CharTypeEnum charType = CharTypeEnum.DEFAULT;

    /**
     * 验证码图片宽度
     */
    private int width = 130;

    /**
     * 验证码图片高度
     */
    private int height = 48;

    /**
     * 验证码文本长度
     */
    private int length = 4;

    /**
     * 字体
     */
    private InnerFontEnum fontType = InnerFontEnum.FONT_1;

    /**
     * 字体风格
     */
    private int fontStyle = 1;

    /**
     * 字体大小
     */
    private int fontSize = 15;

    /**
     * 存储实现
     */
    private Class<? extends CaptchaStore> storeImpl = CaptchaLocalStoreImpl.class;

    /**
     * 有效期，单位：秒
     */
    private int expiration = 300;
}
